<template>

	<Layout class="p-5 bg-white">
		<Form class="p-5" :model="houseRentClientVo" :label-width="80">
			<FormItem class="w-50" label="求租标题">
				<Input v-model="houseRentClientVo.title" />
			</FormItem>
			<FormItem class="w-50" label="求租详情">
				<Input v-model="houseRentClientVo.detail" />
			</FormItem>
			<FormItem class="w-50" label="联系人">
				<Input v-model="houseRentClientVo.personName" />
			</FormItem>
			<FormItem class="w-50" label="联系电话">
				<Input v-model="houseRentClientVo.tel" />
			</FormItem>
			<FormItem class="w-50" label="联系微信">
				<Input v-model="houseRentClientVo.wxNumber" />
			</FormItem>
			<FormItem class="text-right">
				<Button @click="submit" type="primary">提交</Button>
				<Button @click="cancel" class="ml-2">取消</Button>
			</FormItem>
		</Form>
	</Layout>
</template>
<script>
	export default {
		data() {
			return {
				houseRentClientVo: {
					houseRentId: "",
					title: "",
					detail: "",
					ct: "",
					ut: "",
					clientId: "",
					personName: "",
					tel: "",
					wxNumber:'',
				}
			}
		},
		methods: {
			cancel: function() {
				this.$tabs.close();
			},
			submit: function() {
				let self = this;
				let houseRentClientVos = [];
				for (let index in this.$data.houseRentClientVos) {
					let houseRentClientVoItem = this.$data.houseRentClientVo[index];
					houseRentClientVos.push(houseRentClientVoItem.houseRentClientVoId);
				}
				self.houseRentClientVo.houseRentClientVos = JSON.stringify(houseRentClientVos);
				this.http.put({
					url: "/house-rent-client-vo/info",
					param: self.houseRentClientVo,
				}).then(() => {
					self.message.info("修改成功");
					self.$tabs.close();
					this.$router.push({
						name: "houseRent"
					})
				});
			},
			init: function() {
				let self = this;
				this.http.get({
					url: "/house-rent-client-vo/info",
					param: {
						houseRentId: this.$data.houseRentClientVo.houseRentId
					}
				}).then(data => {
					self.$data.houseRentClientVo = data;
				});
			},
		},
		created: function() {
			this.$data.houseRentClientVo.houseRentId = this.$route.params.houseRentId;
			this.init();
		},
	}
</script>

<style>
</style>
